Page({

  data: {
    userInfo: null,
  },


  login(e) {
    let that = this;
    wx.getUserProfile({
      desc: 'desc',
      success(res) {
        //  console.log(res);
        wx.login({
          success(res1) {
            //  console.log(res1);
            wx.request({
              url: 'http://kr.aynakedu.com/api/krlogin',
              data: {
                code: res1.code,
                userInfo: res.userInfo,
              },
              method: "POST",
              success(res2) {
                that.setData({
                  userInfo: res2.data.userInfo,
                })
              }
            })
          }
        })
      }
    })
  }
})